﻿@model IEnumerable<WebDauGia.Domain.Models.LoaiSanPham>
@{
    ViewBag.Title = "Admin: Loại sản phẩm";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

<h2>Admin: Danh sách loại sản phẩm</h2>
<form id="mainform" action="">
    <table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
        <tr>
            <th class="table-header-repeat line-left"><a href="">ID</a></th>
            <th class="table-header-repeat line-left"><a href="">Tên</a></th>
            <th class="table-header-repeat line-left"><a href="">Loại danh mục</a></th>
            <th class="table-header-repeat line-left"><a href="">Mô tả</a></th>
            <th class="table-header-repeat line-left"><a href="">Active</a></th>
            <th class="table-header-repeat line-left"><a href="">Actions</a></th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td>@item.id</td>
                <td>@Html.ActionLink(item.ten, "EditLoaiSanPham", new { item.id })</td>
                @if (item.DanhMucSanPham == null) { 
                    <td>@item.iddanhmuc</td>
                }
                else { 
                    <td>@item.DanhMucSanPham.ten</td>
                }
                <td>@item.mota</td>
                <td>@item.active</td>
                <td class="options-width">
                    <a href="" title="Edit" class="icon-1 info-tooltip"></a> |
                    @Html.ActionLink("Delete", "Delete", new { id = item.id })
                     @*@using (Html.BeginForm("DeleteLoaiSP", "AdminLoaiSanPham"))
                    {

                        @Html.Hidden("id", item.id)
                       
                        <input type="submit" value="Delete" />


                    }*@
                </td>
            </tr>
        }
    </table>
</form>
<p>@Html.ActionLink("Thêm Loại sản phẩm mới", "CreateLoaiSanPham")</p>